import requests
from lxml import etree
import json
import re

url = 'http://quotes.toscrape.com/js/page/1/'
response = requests.get(url)
data = re.findall(r'<script>(.*?]);.*?</script>',response.text,re.S)
# 去掉 "var data = " 前缀
json_str = data[0].strip().replace('var data = ', '')
# 将JSON字符串转换为Python列表
json_data = json.loads(json_str)
# 格式化输出，带缩进和中文显示
for data in json_data:
    print(data)

